<template>
<div style="width: 100%">
  <el-menu
      default-active="1"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      style="width: 100%"
      active-text-color="#ffd04b">
    <el-menu-item index="1"><a href="http://localhost:3000/#/leader" target="_self">你好，{{name}}</a></el-menu-item>
    <el-menu-item index="2" class="right-arrow" @click="selfInformation">个人信息</el-menu-item>
    <el-menu-item index="3"><a href="http://localhost:3000/#/login" @click="logout" target="_self">退出登录</a></el-menu-item>
  </el-menu>
</div>
</template>

<script>
export default {
  data () {
    return {
      name: '分管领导'
    }
  },
  methods: {
    handleSelect (key, keyPath) {
      console.log(key, keyPath)
    },
    selfInformation () {
      this.$router.push({name: 'selfInformation'})
    },
    logout () {
      localStorage.removeItem('user')
    }
  }
}
</script>

<style scoped>
.el-menu-demo {
  justify-content: flex-end; /* 将菜单项对齐到右侧 */
}
</style>
